//
//  CreateDishTask.m
//  ZooNgonDoiOS
//
//  Created by Anh Jun Linh Tinh on 6/25/12.
//  Copyright (c) 2012 Personal. All rights reserved.
//

#import "CreateDishTask.h"
#import "RKParams.h"

@implementation CreateDishTask

-(id)initWithParam:(NSString *)dishName spotId:(NSString *)spotId{
    self = [super init];
    if(self){
        _dishName = dishName;
        _spotId = spotId;
    }
    return self;
}

-(void)doExecute{
     NSDictionary *dic = [NSDictionary dictionaryWithKeysAndObjects:@"spot_id",_spotId,@"name",_dishName,nil];
    [[RKObjectManager sharedManager].client put:@"/dish" usingBlock:^(RKRequest *request){
        request.params = dic;
        request.delegate = self;
    }];
}

-(void)request:(RKRequest *)request didReceiveResponse:(RKResponse *)response{
    NSLog(@"%@",[response bodyAsString]);
}
-(void)request:(RKRequest *)request didFailLoadWithError:(NSError *)error{
    NSLog(@"%@",[request.response bodyAsString]);
}
@end
